/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.business.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseBusiness;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
* @website https://el-admin.vip
* @description /
* @author xiahongbo
* @date 2022-07-14
**/
@Entity
@Data
@Table(name="BIS_QY")
public class Qy extends BaseBusiness implements Serializable {

    @Id
    @GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
    @GeneratedValue(generator = "hibernate-uuid")
    @Column(name = "BIS_QY_ID")
    @ApiModelProperty(value = "主键ID")
    private String bisQyId;

    @Column(name = "BIS_QY_HLJG_ID")
    @ApiModelProperty(value = "居家机构ID")
    private String bisQyHljgId;

    @Column(name = "BIS_QY_ZHSQ_ID")
    @ApiModelProperty(value = "照护申请ID")
    private Long bisQyZhsqId;

    @Column(name = "BIS_QY_QYSJ")
    @ApiModelProperty(value = "签约时间")
    private Date bisQyQysj;

    @Column(name = "BIS_QY_ZT")
    @ApiModelProperty(value = "签约状态")
    private String bisQyZt;

    @Column(name = "BIS_QY_MP_ZT")
    @ApiModelProperty(value = "移动端签约状态")
    private String bisQyMpzt;

    @Column(name = "BIS_GSGL_CQHLFWLX")
    @ApiModelProperty(value = "服务类型")
    private String bisGsglCqhlfwlx;

    @Column(name = "BIS_GSGL_ISZF")
    @ApiModelProperty(value = "是否作废")
    private String bisGsglIszf;

    @Column(name = "BIS_QY_YLLX")
    @ApiModelProperty(value = "医疗类型")
    private String bisQyYllx;

    @OneToOne
    @JoinColumn(name="BIS_QY_ZHSQ_ID", referencedColumnName="BIS_ZHSQ_ID",insertable = false,updatable = false)
    private Zhsq zhsq;

    public void copy(Qy source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    @Override
    public int hashCode() {
        return Objects.hash(bisQyId, bisQyHljgId, bisQyZhsqId);
    }
}